package com.haiheng.library_base.db.converters;

import java.util.Calendar;
import java.util.Date;

import androidx.room.TypeConverter;

/**
 * @Des:
 * @Author: hwz
 * @Date:2021/9/2 0002
 * @Version: 1.0
 */
public class DateConverters {

    @TypeConverter
    public static Date toDate(long date) {
        return new Date(date);
    }

    @TypeConverter
    public static long fromDate(Date date) {
        return date == null ? Calendar.getInstance().getTimeInMillis() : date.getTime();
    }

}
